﻿@{
    Layout = "~/Views/Shared/OA/_Index.cshtml";

}
@section Toolbar
{
    @Html.MyNet().Button(new ButtonOptions { Text = "查看详情", Click = "detail" })
}
@section Menu
{
    @Html.MyNet().Menu(new ButtonOptions { Text = "查看详情", Click = "detail()" })
}
@section Query
{
    @Html.Partial("_Query", new SuggestCondition())
}
@section Main
{
    <div id="grid" class="grid">
    </div>
    <div id="pager" class="pager">
    </div>
}
<script>

    var url = "/Common/Suggest/";
    jQuery(function () {
        read();
    });

    function read() {
        $.ajax
        ({
            url: url + "Read",
            data: query,
            type: "post",
            error: disposeError,
            success: function (result) {
                if (disposeException(result)) return;
                bind(result);
            }
        });
    }


    function detail() {
        nav(url + "Detail?Id=" + gridSelected()[0]);
    }


    function enable() {
        if (!gridSelected()) return alert("未选中任何数据！");

        $.ajax
        ({
            url: url + "Enable",
            data: { ids: gridSelected() },
            type: "post",
            error: disposeError,
            success: function (result) {
                if (disposeException(result)) return;

                read();
            }
        });
    }

    function disable() {
        if (!gridSelected()) return alert("未选中任何数据！");

        $.ajax
        ({
            url: url + "Disable",
            data: { ids: gridSelected() },
            type: "post",
            error: disposeError,
            success: function (result) {
                if (disposeException(result)) return;
                read();
            }
        });
    }

</script>
